package b_IO;

import org.testng.annotations.Test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class ByteStreamDemo1 {
    @Test
    public void write1() throws IOException {
        FileOutputStream fos = new FileOutputStream("a.txt");
        fos.write(99);
        fos.write(22);
        fos.write(200);
        fos.write(255);
        fos.write(-1);

    }
    @Test
    public void read1() throws IOException {
        FileInputStream fis = new FileInputStream("a.txt");
        int i;
        while ((i=fis.read()) != -1){
            System.out.println(i);
        }
    }
}
